<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            color: aqua;
        }
    </style>
</head>

<body>
    <div id="div1" style="color:blue" class="ss">div1</div>
    <div id="div2">
        div2
        <p id="p2">12</p>
    </div>
    <div id="div3">
        <p id="p1" class="box">p1</p>
    </div>

    <span id="span1">span标签</span>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
    <script>
        let div1 = document.querySelector("#div1")
        console.log(div1)
        let p1 = document.querySelector(".box")
        console.log(p1)
        let divs = document.getElementsByTagName("div")
        console.log(divs)
        divs[0].append("1221")
        let h1 = document.createElement("h1")
        h1.innerText = "这是个h1标签"
        divs[2].append(h1)
        p2 = document.getElementById("p2")
        h3 = document.createElement("h3")
        h3.innerText = "h3"
        divs[1].insertBefore(h3, p2)
        let span1 = document.getElementById("span1")
        span1.remove()
            //获取元素
        let list = document.getElementsByTagName("ul")
        console.log(list)
            // for(item of list[0].children){
            //     item.innerText="6"
            // }
        console.log(list[0].firstElementChild)
        console.log(list[0].firstElementChild.nextSibling) //换行符文本节点
        console.log(list[0].firstElementChild.nextElementSibling)
            // list[0].children[1].remove()
            // list[0].firstElementChild.nextElementSibling.remove()
        list[0].removeChild(list[0].children[1])

        console.log(p1.parentElement)
            // p1.parentElement.removeChild(p1)
        divs[2].removeChild(p1)
    </script>
</body>

</html>